<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    ul{
        list-style: none;
        display: flex;
    }
    ul li{
        padding: 20px 40px;
        cursor: pointer;
        background-color: #ccc;
        margin-right: 10px;
    }
    .active{
        color:red;
        background-color: pink
    }
    
    </style>
</head>
<body>
    <div class="box">
        <ul id="ul">
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>
    <script src="../jquery-1.12.4.js"></script>
    <script>
    $("ul").on('mouseenter','li',function(){
        $(this).addClass('active').siblings().removeClass('active')
    })
    
    </script>
</body>
</html>